//
// Created by Joey on 2019/12/14.
//
#include<iostream>
using namespace std;

int main() {
    srand((unsigned) time(NULL));

    int target = rand() % 100 + 1;
    int guess = 0;
    int guess_times = 0;
//    cout << "" << target << endl;
    cout << "随机数（1～100）已经生成，请输入一个数字进行猜测" << endl;

    cin >> guess;
    guess_times += 1;

    while (guess != target) {
        if (guess > target) {
            cout << "猜大了，";
        } else {
            cout << "猜小了，";
        }

        cout << "请继续输入\t" << endl;
        cin >> guess;
        guess_times += 1;
    }
    cout << "猜对了，答案是：" << target << endl;
    cout << "一共猜了 " << guess_times << " 次" << endl;
}
